﻿// -----------------------------------------------------------------------
// <copyright file="Utils.cs" company="Diddly Squad">
// </copyright>
// -----------------------------------------------------------------------

using Microsoft.Xna.Framework;

namespace DiddlySquat
{
	/// <summary>
	/// Some util methods used from many places
	/// </summary>
	public static class Utils
	{
		private static System.Random generator = new System.Random();

		/// <summary>
		/// Calculates distances between two items.
		/// </summary>
		/// <param name="a">The first item.</param>
		/// <param name="b">The second item.</param>
		/// <returns></returns>
		public static float DistanceToTarget(Vector2 a, Vector2 b)
		{
			double dist = System.Math.Sqrt(((a.X - b.X) * (a.X - b.X)) + ((a.Y - b.Y) * (a.Y - b.Y)));
			return (float)dist;
		}

		/// <summary>
		/// Gets the random integer.
		/// </summary>
		/// <param name="maxValue">The max value.</param>
		/// <returns>Random integer.</returns>
		public static int GetRandomInteger(int maxValue)
		{
			int rand = generator.Next(maxValue);
			return rand;
		}
	}
}
